package com.aaa.entity;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.TypeReference;
import com.aaa.utils.BaseDao;
import lombok.Data;

import java.util.Date;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * (Emp)实体类
 *
 * @author
 * @since 2022-08-15 09:23:41
 */
@Data
public class Emp implements Serializable {
    private static final long serialVersionUID = 580866928235534047L;
    /**
     * 主键，员工编号
     */
    private Integer empno;

    private String ename;

    private String job;

    private Integer mgr;

    private Date hiredate;

    private Double sal;

    private Double comm;

    private Integer deptno;


    public static void main(String[] args) {
        BaseDao baseDao = new BaseDao();
        List<Map<String, Object>> mapList = baseDao.executeQuery("select * from emp ");
        for (Map<String, Object> stringObjectMap : mapList) {
            System.out.println(stringObjectMap);
        }
        System.out.println("开始转换");
        List<Emp> empList = Convert.convert(new TypeReference<List<Emp>>() {}, mapList);
        for (Emp emp : empList) {
            System.out.println(emp.toString());
        }
    }

}

